import React from "react";
/* 
如何让普通组件拥有高阶组件（比如路由）的属性
*/
import {withRouter} from 'react-router-dom'
import '../assets/css/header.css'
class Home extends React.Component {
    componentDidMount(){
        console.log(this,'头部的this');
    }
    //跳转到分类
    goCate(){
        console.log(this.props,'进入事件了');
        //跳转到分类
        this.props.history.push('/index/cate')
    }
  render() {
    return (
      <div className='header'>
        <div>
          <h1>我是头部</h1>
          <p onClick={()=>this.goCate()}>我这里有很多的</p>
        </div>
      </div>
    );
  }
}
export default withRouter(Home) ;
